package com.tj.jinzao.presenter;

import android.util.Log;

import com.tj.jinzao.api.SubscriberCallBack;
import com.tj.jinzao.base.BasePresenter;
import com.tj.jinzao.callback.IListGroupView;
import com.tj.jinzao.model.GroupBean;
import com.tj.jinzao.model.ResultResponse;

import java.util.HashMap;

public class GroupPresenter extends BasePresenter<IListGroupView<GroupBean>> {
    public GroupPresenter(IListGroupView<GroupBean> view) {
        super(view);
    }
    //创建群
    public void createGroup(HashMap<String, Object> map) {
        addSubscription(mApiService.createGroup(map), new SubscriberCallBack<GroupBean>(mView.getContext()) {
            @Override
            protected void onSuccess(GroupBean list) {
                if (mView != null) mView.onCreateGroupSuccess(list);
            }

            @Override
            protected void onFailure(ResultResponse response) {
                Log.w("创建成功","www"+response.getMessage());
                if (mView != null) mView.onFailed(response);
            }

            @Override
            protected boolean isShowProgress() {
                return false;
            }

            @Override
            protected void onPageSuccess(int currentPage, int allPage, int allSize) {
                if (mView != null) mView.onFailed(null);
            }
        });
    }

}
